package org.zfes.snowier.cloud.zbss.cms.router.service.column;

import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.column.model.CmsColumn;
import org.zfes.snowier.cloud.zbss.cms.column.service.ICmsColumnService;
import org.zfes.snowier.cloud.zbss.cms.column.service.ICmsColumnUserService;
@Controller("org.zfes.snowier.cloud.zbss.cms.column.router.service.cmsColumnController") 
@RequestMapping("/cms/service/column/cmsColumn")
public class CmsColumnController extends BaseController {

	
	@Autowired
	private ICmsColumnService cmsColumnService;
	@Autowired
	private ICmsColumnUserService cmsColumnUserService;
	
	//返回Map<String,List<CmsColumn>> 有key:subscribeColumnList   key:notSubscribeColumnList
	@RequiresPermissions(value="cmsColumn:loadColumnIdSubscribeAndNot",desc="栏目用户订阅及未订阅加载")
    @RequestMapping(value="/loadColumnIdSubscribeAndNot", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadColumnIdSubscribeAndNot(Long userId){
		Map<String,List<CmsColumn>> columnMap=cmsColumnService.loadColumnIdSubscribeAndNot(userId);
		return ajaxQuery("columnMap",columnMap);
    }
	
	@RequiresPermissions(value="cmsColumnUser:loadCmsColumnUser",desc="栏目用户订阅加载")
    @RequestMapping(value="/loadCmsColumnUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsColumnUser(Long userId){
		List<Long> columnIdList = cmsColumnUserService.loadColumnIdByUserId(userId);
		return ajaxQuery("columnIdList",columnIdList);
    }

}